package com.zcc.makingfriend.service.impl;

import com.zcc.makingfriend.dao.WebLogin;
import com.zcc.makingfriend.mapper.WebLoginMapper;
import com.zcc.makingfriend.service.WebLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zcc
 */
@Service
public class WebLoginServiceImpl implements WebLoginService {

    @Autowired
    WebLoginMapper webLoginMapper;

    @Override
    public String login(WebLogin webLogin) {
        String username = webLogin.getUsername();
        WebLogin byUsername = webLoginMapper.findByUsername(username);
        if (byUsername == null) {
            return "用户不存在";
        } else {
            if (byUsername.getPassword().equals(webLogin.getPassword())) {
                return "登录成功";
            } else {
                return "密码错误";
            }
        }
    }
}
